package vivo.com.foolishbar.core.warp.page;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class Blog {
	private Long id;
	private String subject;
	private String text;

	public Blog() {
		// must have a default constructor.
	}

	public Blog(String subject, String text) {
		super();
		this.id = 0l;
		this.subject = subject;
		this.text = text;
	}

	/*
	 * Methods
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == null) {
			return true;
		}
		if (obj == null || !(obj instanceof Blog)) {
			return false;
		}

		Blog another = (Blog) obj;
		if (another.id == null) {
			return false;
		}

		return this.getId().equals(((Blog) obj).id);
	}

	@Override
	public int hashCode() {
		if (this.id == null) {
			return 0;
		}
		return this.id.hashCode();
	}

	/*
	 * Getter and Setters
	 */

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

}
